# 单词逆序
def reverseWords(s:str):
    tokens = s.split(' ')
    tokens.reverse()
    return ' '.join(tokens)

print(reverseWords('i am a student.'))

# 旋转字符串
def rotateString(s,goal):
    if len(s) != len(goal):
        return False
    return goal in (s + s)

print(rotateString('abcde','sdfe'))
print(rotateString('abcde','bcdea'))

def countPrefixes(words:list,s:str):
    count = 0
    for word in words:
        if s.startswith((word)):
            # s 是以 word 开头
            count += 1
    return count

print(countPrefixes(['a','b','c','ab','abc'],'abc'))